﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.Generic;

namespace Nok_Air.NokObjects
{
    public class PricingV2ItemViewModel : INotifyPropertyChanged
    {
       /*
       <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <PricingV2Response xmlns="http://www.nokair.com/webservices/">
      <PricingV2Result>
        <PriceSummary xmlns="">
          <PricingID>0904041118495468750</PricingID>
          <FareDesignator></FareDesignator>
          <LockFares />
          <PricingResponseVersion>V005</PricingResponseVersion>
          <TotalAmount>11061.43027</TotalAmount>
          <SurchargeTotalAmount>600.00000</SurchargeTotalAmount>
          <FareTotalAmount>9157.01953</FareTotalAmount>
          <FeeTotalAmount note="vat included">21.40</FeeTotalAmount>
          <TaxTotalAmount>1283.01001</TaxTotalAmount>
          <Currency>THB</Currency>
          <PassengerCodes>
            <PassengerCode>
              <PassengerCode>ADULT</PassengerCode>
              <SeatCount>2</SeatCount>
              <FareValuePerSeat>3052.34009</FareValuePerSeat>
              <SurchargePerSeat>200.00000</SurchargePerSeat>
              <TaxValuePerSeat>427.67001</TaxValuePerSeat>
              <FareLadder>DMK DD AN50.00 IN50.00 CNX1666.36P1CNX DD AN50.00 IN50.00 DMK1385.98W13252.34 END ATDMK100.00VATTH123.65ATCNX100.00VATTH104.02</FareLadder>
              <FareCodes>
                <FareCode>
                  <CompanyCode>DD</CompanyCode>
                  <FareCode>P1</FareCode>
                  <Description>Nok Eco P Class One-Way</Description>
                  <ClassCode>P</ClassCode>
                  <PassengerCode>ADULT</PassengerCode>
                  <Refundable>0</Refundable>
                  <OneWayReturn>0</OneWayReturn>
                  <BaseAmount>1666.35999</BaseAmount>
                  <BaseCurrency>THB</BaseCurrency>
                  <ChangeType />
                  <ChangeAmount>0.00000</ChangeAmount>
                  <FinalAmount>1666.35999</FinalAmount>
                  <CurrencyCode>THB</CurrencyCode>
                  <Endorsement />
                  <Restriction />
                  <ValidFrom>2011-03-27</ValidFrom>
                  <ValidTo>2011-05-31</ValidTo>
                  <FareRouteID>456702109410485472</FareRouteID>
                  <NetFareFlag>0</NetFareFlag>
                  <PrivateFareFlag>0</PrivateFareFlag>
                  <Flights>
                    <Flight>
                      <FlightNo>DD8300</FlightNo>
                      <FlightDate>2011-04-07</FlightDate>
                      <AirportCodes>
                        <AirportCode>DMK</AirportCode>
                        <AirportCode>CNX</AirportCode>
                      </AirportCodes>
                    </Flight>
                  </Flights>
                  <SurchargeCodes>
                    <SurchargeCode>
                      <SurchargeCode>AN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Administration Fee</Description>
                      <RouteSurchargeID>406842481171657943</RouteSurchargeID>
                    </SurchargeCode>
                    <SurchargeCode>
                      <SurchargeCode>IN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Insurance</Description>
                      <RouteSurchargeID>1049066359271523354</RouteSurchargeID>
                    </SurchargeCode>
                  </SurchargeCodes>
                </FareCode>
                <FareCode>
                  <CompanyCode>DD</CompanyCode>
                  <FareCode>W1</FareCode>
                  <Description>Nok Eco W Class One-Way</Description>
                  <ClassCode>W</ClassCode>
                  <PassengerCode>ADULT</PassengerCode>
                  <Refundable>0</Refundable>
                  <OneWayReturn>0</OneWayReturn>
                  <BaseAmount>1385.97998</BaseAmount>
                  <BaseCurrency>THB</BaseCurrency>
                  <ChangeType />
                  <ChangeAmount>0.00000</ChangeAmount>
                  <FinalAmount>1385.97998</FinalAmount>
                  <CurrencyCode>THB</CurrencyCode>
                  <Endorsement />
                  <Restriction />
                  <ValidFrom>2011-03-27</ValidFrom>
                  <ValidTo>2011-05-31</ValidTo>
                  <FareRouteID>565793461366785032</FareRouteID>
                  <NetFareFlag>0</NetFareFlag>
                  <PrivateFareFlag>0</PrivateFareFlag>
                  <Flights>
                    <Flight>
                      <FlightNo>DD8301</FlightNo>
                      <FlightDate>2011-04-10</FlightDate>
                      <AirportCodes>
                        <AirportCode>CNX</AirportCode>
                        <AirportCode>DMK</AirportCode>
                      </AirportCodes>
                    </Flight>
                  </Flights>
                  <SurchargeCodes>
                    <SurchargeCode>
                      <SurchargeCode>AN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Administration Fee</Description>
                      <RouteSurchargeID>576386030728357090</RouteSurchargeID>
                    </SurchargeCode>
                    <SurchargeCode>
                      <SurchargeCode>IN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Insurance</Description>
                      <RouteSurchargeID>334326676508963999</RouteSurchargeID>
                    </SurchargeCode>
                  </SurchargeCodes>
                </FareCode>
              </FareCodes>
              <TaxCodes>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>AT</TaxCode>
                  <CoverageType>A</CoverageType>
                  <CoverageValue>DMK</CoverageValue>
                  <ShortDescription>Airport Tax</ShortDescription>
                  <TaxType>=</TaxType>
                  <TaxValue>100.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>100.00000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>46</TaxDetailID>
                  <FlightNumber>DD8300</FlightNumber>
                  <FlightDate>2011-04-07</FlightDate>
                  <Origin>DMK</Origin>
                  <Destination>CNX</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>VAT</TaxCode>
                  <CoverageType>N</CoverageType>
                  <CoverageValue>TH</CoverageValue>
                  <ShortDescription>Value Added Tax</ShortDescription>
                  <TaxType>%</TaxType>
                  <TaxValue>7.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>123.65000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>17</TaxDetailID>
                  <FlightNumber>DD8300</FlightNumber>
                  <FlightDate>2011-04-07</FlightDate>
                  <Origin>DMK</Origin>
                  <Destination>CNX</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>AT</TaxCode>
                  <CoverageType>A</CoverageType>
                  <CoverageValue>CNX</CoverageValue>
                  <ShortDescription>Airport Tax</ShortDescription>
                  <TaxType>=</TaxType>
                  <TaxValue>100.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>100.00000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>43</TaxDetailID>
                  <FlightNumber>DD8301</FlightNumber>
                  <FlightDate>2011-04-10</FlightDate>
                  <Origin>CNX</Origin>
                  <Destination>DMK</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>VAT</TaxCode>
                  <CoverageType>N</CoverageType>
                  <CoverageValue>TH</CoverageValue>
                  <ShortDescription>Value Added Tax</ShortDescription>
                  <TaxType>%</TaxType>
                  <TaxValue>7.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>104.02000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>17</TaxDetailID>
                  <FlightNumber>DD8301</FlightNumber>
                  <FlightDate>2011-04-10</FlightDate>
                  <Origin>CNX</Origin>
                  <Destination>DMK</Destination>
                </TaxCode>
              </TaxCodes>
            </PassengerCode>
            <PassengerCode>
              <PassengerCode>CHD</PassengerCode>
              <SeatCount>1</SeatCount>
              <FareValuePerSeat>3052.34009</FareValuePerSeat>
              <SurchargePerSeat>200.00000</SurchargePerSeat>
              <TaxValuePerSeat>427.67001</TaxValuePerSeat>
              <FareLadder>DMK DD IN50.00 AN50.00 CNX1666.36P1CNX DD IN50.00 AN50.00 DMK1385.98W13252.34 END ATDMK100.00VATTH123.65ATCNX100.00VATTH104.02</FareLadder>
              <FareCodes>
                <FareCode>
                  <CompanyCode>DD</CompanyCode>
                  <FareCode>P1</FareCode>
                  <Description>Nok Eco P Class One-Way</Description>
                  <ClassCode>P</ClassCode>
                  <PassengerCode>CHD</PassengerCode>
                  <Refundable>0</Refundable>
                  <OneWayReturn>0</OneWayReturn>
                  <BaseAmount>1666.35999</BaseAmount>
                  <BaseCurrency>THB</BaseCurrency>
                  <ChangeType />
                  <ChangeAmount>0.00000</ChangeAmount>
                  <FinalAmount>1666.35999</FinalAmount>
                  <CurrencyCode>THB</CurrencyCode>
                  <Endorsement />
                  <Restriction />
                  <ValidFrom>2011-03-27</ValidFrom>
                  <ValidTo>2011-05-31</ValidTo>
                  <FareRouteID>456702109410485472</FareRouteID>
                  <NetFareFlag>0</NetFareFlag>
                  <PrivateFareFlag>0</PrivateFareFlag>
                  <Flights>
                    <Flight>
                      <FlightNo>DD8300</FlightNo>
                      <FlightDate>2011-04-07</FlightDate>
                      <AirportCodes>
                        <AirportCode>DMK</AirportCode>
                        <AirportCode>CNX</AirportCode>
                      </AirportCodes>
                    </Flight>
                  </Flights>
                  <SurchargeCodes>
                    <SurchargeCode>
                      <SurchargeCode>IN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Insurance</Description>
                      <RouteSurchargeID>597937843818755095</RouteSurchargeID>
                    </SurchargeCode>
                    <SurchargeCode>
                      <SurchargeCode>AN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Administration Fee</Description>
                      <RouteSurchargeID>85687159847150701</RouteSurchargeID>
                    </SurchargeCode>
                  </SurchargeCodes>
                </FareCode>
                <FareCode>
                  <CompanyCode>DD</CompanyCode>
                  <FareCode>W1</FareCode>
                  <Description>Nok Eco W Class One-Way</Description>
                  <ClassCode>W</ClassCode>
                  <PassengerCode>CHD</PassengerCode>
                  <Refundable>0</Refundable>
                  <OneWayReturn>0</OneWayReturn>
                  <BaseAmount>1385.97998</BaseAmount>
                  <BaseCurrency>THB</BaseCurrency>
                  <ChangeType />
                  <ChangeAmount>0.00000</ChangeAmount>
                  <FinalAmount>1385.97998</FinalAmount>
                  <CurrencyCode>THB</CurrencyCode>
                  <Endorsement />
                  <Restriction />
                  <ValidFrom>2011-03-27</ValidFrom>
                  <ValidTo>2011-05-31</ValidTo>
                  <FareRouteID>565793461366785032</FareRouteID>
                  <NetFareFlag>0</NetFareFlag>
                  <PrivateFareFlag>0</PrivateFareFlag>
                  <Flights>
                    <Flight>
                      <FlightNo>DD8301</FlightNo>
                      <FlightDate>2011-04-10</FlightDate>
                      <AirportCodes>
                        <AirportCode>CNX</AirportCode>
                        <AirportCode>DMK</AirportCode>
                      </AirportCodes>
                    </Flight>
                  </Flights>
                  <SurchargeCodes>
                    <SurchargeCode>
                      <SurchargeCode>IN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Insurance</Description>
                      <RouteSurchargeID>24749425329271859</RouteSurchargeID>
                    </SurchargeCode>
                    <SurchargeCode>
                      <SurchargeCode>AN</SurchargeCode>
                      <Amount>50.00000</Amount>
                      <Description>Administration Fee</Description>
                      <RouteSurchargeID>907772114110960710</RouteSurchargeID>
                    </SurchargeCode>
                  </SurchargeCodes>
                </FareCode>
              </FareCodes>
              <TaxCodes>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>AT</TaxCode>
                  <CoverageType>A</CoverageType>
                  <CoverageValue>DMK</CoverageValue>
                  <ShortDescription>Airport Tax</ShortDescription>
                  <TaxType>=</TaxType>
                  <TaxValue>100.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>100.00000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>46</TaxDetailID>
                  <FlightNumber>DD8300</FlightNumber>
                  <FlightDate>2011-04-07</FlightDate>
                  <Origin>DMK</Origin>
                  <Destination>CNX</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>VAT</TaxCode>
                  <CoverageType>N</CoverageType>
                  <CoverageValue>TH</CoverageValue>
                  <ShortDescription>Value Added Tax</ShortDescription>
                  <TaxType>%</TaxType>
                  <TaxValue>7.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>123.65000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>17</TaxDetailID>
                  <FlightNumber>DD8300</FlightNumber>
                  <FlightDate>2011-04-07</FlightDate>
                  <Origin>DMK</Origin>
                  <Destination>CNX</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>AT</TaxCode>
                  <CoverageType>A</CoverageType>
                  <CoverageValue>CNX</CoverageValue>
                  <ShortDescription>Airport Tax</ShortDescription>
                  <TaxType>=</TaxType>
                  <TaxValue>100.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>100.00000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>43</TaxDetailID>
                  <FlightNumber>DD8301</FlightNumber>
                  <FlightDate>2011-04-10</FlightDate>
                  <Origin>CNX</Origin>
                  <Destination>DMK</Destination>
                </TaxCode>
                <TaxCode>
                  <CompanyCode>DD</CompanyCode>
                  <TaxCode>VAT</TaxCode>
                  <CoverageType>N</CoverageType>
                  <CoverageValue>TH</CoverageValue>
                  <ShortDescription>Value Added Tax</ShortDescription>
                  <TaxType>%</TaxType>
                  <TaxValue>7.00000</TaxValue>
                  <TaxCurrency>THB</TaxCurrency>
                  <AppliedAmount>104.02000</AppliedAmount>
                  <AppliedCurrency>THB</AppliedCurrency>
                  <Compounded>0</Compounded>
                  <PassengerCode />
                  <TaxDetailID>17</TaxDetailID>
                  <FlightNumber>DD8301</FlightNumber>
                  <FlightDate>2011-04-10</FlightDate>
                  <Origin>CNX</Origin>
                  <Destination>DMK</Destination>
               <FeeCodes>
            <Fee>
              <FeeCode>ATM</FeeCode>
              <Description>ATM Sales Transaction Fee</Description>
              <Amount>20.00</Amount>
              <Tax>1.40</Tax>
              <CurrencyCode>THB</CurrencyCode>
            </Fee>
          </FeeCodes>  </TaxCode>
              </TaxCodes>
            </PassengerCode>
          </PassengerCodes>
          <Notes />
         
        </PriceSummary>
      </PricingV2Result>
    </PricingV2Response>
  </soap:Body>
</soap:Envelope>
         */
        private string _PricingID;
        public string PricingID
        {
            get
            {
                return _PricingID;
            }
            set
            {
                if (value != _PricingID)
                {
                    _PricingID = value;
                    NotifyPropertyChanged("PricingID");
                }
            }
        }
        private string _TotalAmount;
        public string TotalAmount
        {
            get
            {
                return _TotalAmount;
            }
            set
            {
                if (value != _TotalAmount)
                {
                    _TotalAmount = value;
                    NotifyPropertyChanged("TotalAmount");
                }
            }
        }
        private string _FeeTotalAmount;
        public string FeeTotalAmount
        {
            get
            {
                return _FeeTotalAmount;
            }
            set
            {
                if (value != _FeeTotalAmount)
                {
                    _FeeTotalAmount = value;
                    NotifyPropertyChanged("FeeTotalAmount");
                }
            }
        }

        private NokObjects.Fee _FeeCodes;
        public NokObjects.Fee FeeCodes
        {
            get
            {
                return _FeeCodes;
            }
            set
            {
                if (value != _FeeCodes)
                {
                    _FeeCodes = value;
                    NotifyPropertyChanged("FeeCodes");
                }
            }
        }
        

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
    public class Fee : INotifyPropertyChanged
    {
        /*
          <Fee>
              <FeeCode>ATM</FeeCode>
              <Description>ATM Sales Transaction Fee</Description>
              <Amount>20.00</Amount>
              <Tax>1.40</Tax>
              <CurrencyCode>THB</CurrencyCode>
            </Fee>
         */
        private string _FeeCode;
        public string FeeCode
        {
            get
            {
                return _FeeCode;
            }
            set
            {
                if (value != _FeeCode)
                {
                    _FeeCode = value;
                    NotifyPropertyChanged("FeeCode");
                }
            }
        }
        private string _Description;
        public string Description
        {
            get
            {
                return _Description;
            }
            set
            {
                if (value != _Description)
                {
                    _Description = value;
                    NotifyPropertyChanged("Description");
                }
            }
        }
        private string _Amount;
        public string Amount
        {
            get
            {
                return _Amount;
            }
            set
            {
                if (value != _Amount)
                {
                    _Amount = value;
                    NotifyPropertyChanged("Amount");
                }
            }
        }
        private string _Tax;
        public string Tax
        {
            get
            {
                return _Tax;
            }
            set
            {
                if (value != _Tax)
                {
                    _Tax = value;
                    NotifyPropertyChanged("FeeCodes");
                }
            }
        }
        private string _FeeTotalAmount;
        public string FeeTotalAmount
        {
            get
            {
                return _FeeTotalAmount;
            }
            set
            {
                if (value != _FeeTotalAmount)
                {
                    _FeeTotalAmount = value;
                    NotifyPropertyChanged("FeeTotalAmount");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
